package com.export.document.controller;

import com.export.document.service.ReadDBService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;
import java.util.Map;

@Controller
@Log4j2
public class PageController {
    @Autowired
    private ReadDBService readService;

    /**
     * 登录首页
     *
     * @return
     */
    @GetMapping("/index")
    public String toIndex(Model model) {
        List<Map<String, Object>> dbs = readService.readDB();
        model.addAttribute("dbs", dbs);
        return "index";
    }
}
